import { request } from '../utils/request';
import type { ApiResponse } from '../types/common';
import type { ChatMessage, ChatResponse, ChatFeedback } from '../types/chat';

export const chatApi = {
  // 发送消息
  sendMessage: (content: string) =>
    request.post<ApiResponse<ChatResponse>>('/api/chat/send', { content }),

  // 获取历史消息
  getHistory: () =>
    request.get<ApiResponse<ChatMessage[]>>('/api/chat/history'),

  // 重新生成回复
  regenerateResponse: (messageId: string) =>
    request.post<ApiResponse<ChatResponse>>(`/api/chat/${messageId}/regenerate`),

  // 提交反馈
  submitFeedback: (messageId: string, feedback: ChatFeedback) =>
    request.post<ApiResponse<void>>(`/api/chat/${messageId}/feedback`, feedback),
}; 